]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-recorder: Optionally return the filename of the recording
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 6 May 2013 22:11:57 +0000 (00:11 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 10 May 2013 17:49:01 +0000 (19:49 +0200)
It is currently not always possible to predict the actual output filename
of a recording - the file-template does not necessarily use an absolute
path and may contain %d and %t escape sequences.
This is OK for fire-and-forget uses like the existing keyboard shortcut,
but we will soon expose the functionality on DBus and consumers of that
API might very well need to access the file after the recording. So do
the same as our screenshot API and add an optional (out) parameter to
record().

https://bugzilla.gnome.org/show_bug.cgi?id=696247

src/shell-recorder.c
src/shell-recorder.h
src/test-recorder.c

index 449590caf92f96dc4c6d12e9e725e9ef42fd0475..aaf585b15aa65edec86a04963f8571fd36c9ec68 100644 (file)
@@ -1708,6 +1708,7 @@ shell_recorder_set_pipeline (ShellRecorder *recorder,
 /**
  * shell_recorder_record:
  * @recorder: the #ShellRecorder
+ * @filename_used: (out) (allow-none): actual filename used for recording
  *
  * Starts recording, Starting the recording may fail if the output file
  * cannot be opened, or if the output stream cannot be created
@@ -1724,7 +1725,8 @@ shell_recorder_set_pipeline (ShellRecorder *recorder,
  * Return value: %TRUE if recording was succesfully started
  */
 gboolean
-shell_recorder_record (ShellRecorder *recorder)
+shell_recorder_record (ShellRecorder  *recorder,
+                       char          **filename_used)
 {
   g_return_val_if_fail (SHELL_IS_RECORDER (recorder), FALSE);
   g_return_val_if_fail (recorder->stage != NULL, FALSE);
@@ -1733,6 +1735,9 @@ shell_recorder_record (ShellRecorder *recorder)
   if (!recorder_open_pipeline (recorder))
     return FALSE;
 
+  if (filename_used)
+    *filename_used = g_strdup (recorder->current_pipeline->filename);
+
   recorder_connect_stage_callbacks (recorder);
 
   recorder->start_time = get_wall_time();
index 9bff65774c9241947cf3e3c494edb5a6decbfad2..a94d59c8f9893baaf7b458e1597e49134296a0e6 100644 (file)
@@ -36,7 +36,8 @@ void               shell_recorder_set_file_template (ShellRecorder *recorder,
                                                      const char    *file_template);
 void               shell_recorder_set_pipeline (ShellRecorder *recorder,
                                                const char    *pipeline);
-gboolean           shell_recorder_record       (ShellRecorder *recorder);
+gboolean           shell_recorder_record       (ShellRecorder  *recorder,
+                                                char          **filename_used);
 void               shell_recorder_close        (ShellRecorder *recorder);
 void               shell_recorder_pause        (ShellRecorder *recorder);
 gboolean           shell_recorder_is_recording (ShellRecorder *recorder);
index 66f8baf0ffca1bd634e8f024d3952eccfa737e89..86f937942a486d18d3348224f0e24bf5b7c0b613 100644 (file)
@@ -48,7 +48,7 @@ on_stage_realized (ClutterActor *stage,
 {
   recorder = shell_recorder_new (CLUTTER_STAGE (stage));
   shell_recorder_set_file_template (recorder, "test-recorder.webm");
-  shell_recorder_record (recorder);
+  shell_recorder_record (recorder, NULL);
 }
 
 int main (int argc, char **argv)